package com.zf.test;

import com.zf.rpc.api.ByeService;
import com.zf.rpc.transport.RpcClientProxy;
import com.zf.rpc.api.HelloObject;
import com.zf.rpc.api.HelloService;
import com.zf.rpc.serializer.CommonSerializer;
import com.zf.rpc.transport.socket.client.SocketClient;

/**
 * @ProjectName: RPC-zhaofeng
 * @Package: com.zf.simpleImplementation
 * @ClassName: testClient
 * @Author: zf
 * @Description:
 * @Date: 2021/5/6 23:25
 * @Version: 1.0
 */
public class SocketTestClient {
    public static void main(String[] args) {
        SocketClient socketClient = new SocketClient(CommonSerializer.KRYO_SERIALIZER);

        RpcClientProxy socketProxy = new RpcClientProxy(socketClient);
        HelloService helloService = socketProxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "This is a message");
        String res = helloService.hello(object);
        System.out.println(res);
        ByeService byeService = socketProxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("Netty"));

    }
}
